﻿'Programmer: Muhammad Yaseen
'Purpose: Enable Multilinguality in Bangbezh project.

Imports Bangbezh.FrmMain
Module Language
    'The PrayerNames in First Language
    Public Pr11 As String = "به‌یانی" 'Fajr in first language
    Public Pr12 As String = "گزنگ"
    Public Pr13 As String = "نیوه‌ڕۆ"
    Public Pr14 As String = "عه‌سر"
    Public pr15 As String = "شێوان"
    Public pr16 As String = "خه‌وتنان"

    'The PrayerNames in second Language
    Public Pr21 As String = "Fajr" 'Fajr in first language
    Public Pr22 As String = "Shruq"
    Public Pr23 As String = "Dhuhr"
    Public Pr24 As String = "Asr"
    Public Pr25 As String = "Maghrib"
    Public Pr26 As String = "Isha"



    Public Sub ChangeLang1(ByVal LangFile As String)
        Dim DataFile As New INIFile
        DataFile.Load(Application.StartupPath & "\Data\Languages\" & LangFile)
        Dim PrayerName As INIFile.IniSection = DataFile.GetSection("PrayerNames")
        Dim MainForm As INIFile.IniSection = DataFile.GetSection("MainForm")
        Dim INFO As INIFile.IniSection = DataFile.GetSection("INFO")
        Pr11 = PrayerName.GetKey("Fajr").GetValue
        Pr12 = PrayerName.GetKey("Shruq").GetValue
        Pr13 = PrayerName.GetKey("Dhuhr").GetValue
        Pr14 = PrayerName.GetKey("Asr").GetValue
        pr15 = PrayerName.GetKey("Maghrib").GetValue
        pr16 = PrayerName.GetKey("Isha").GetValue


        'APPLY
        FrmMain.BangItemFajr.Lang1 = Pr11
        FrmMain.BangItemShruq.Lang1 = Pr12
        FrmMain.BangItemDhuhr.Lang1 = Pr13
        FrmMain.BangItemAsr.Lang1 = Pr14
        FrmMain.BangItemMaghrib.Lang1 = pr15
        FrmMain.BangItemIsha.Lang1 = pr16

        FrmMain.Text = MainForm.GetKey("FrmTitle").GetValue
        'FrmMain.FileToolStripMenuItem.Text = MainForm.GetKey("MnuFile").GetValue
        'FrmMain.ExitToolStripMenuItem.Text = MainForm.GetKey("MnuExit").GetValue
        'FrmMain.ToolsToolStripMenuItem.Text = MainForm.GetKey("MnuTools").GetValue
        'FrmMain.OptionsToolStripMenuItem1.Text = MainForm.GetKey("MnuOptions").GetValue
        'FrmMain.HelpToolStripMenuItem.Text = MainForm.GetKey("MnuHelp").GetValue
        'FrmMain.AboutToolStripMenuItem1.Text = MainForm.GetKey("MnuAbout").GetValue
        If INFO.GetKey("Direction").GetValue = "RTL" Then
            FrmMain.BangItemFajr.Lang1Alignment = ContentAlignment.MiddleRight
            FrmMain.BangItemShruq.Lang1Alignment = ContentAlignment.MiddleRight
            FrmMain.BangItemDhuhr.Lang1Alignment = ContentAlignment.MiddleRight
            FrmMain.BangItemAsr.Lang1Alignment = ContentAlignment.MiddleRight
            FrmMain.BangItemMaghrib.Lang1Alignment = ContentAlignment.MiddleRight
            FrmMain.BangItemIsha.Lang1Alignment = ContentAlignment.MiddleRight
            'FrmMain.MnuStrpMain.RightToLeft = Windows.Forms.RightToLeft.Yes
        Else
            FrmMain.BangItemFajr.Lang1Alignment = ContentAlignment.MiddleLeft
            FrmMain.BangItemShruq.Lang1Alignment = ContentAlignment.MiddleLeft
            FrmMain.BangItemDhuhr.Lang1Alignment = ContentAlignment.MiddleLeft
            FrmMain.BangItemAsr.Lang1Alignment = ContentAlignment.MiddleLeft
            FrmMain.BangItemMaghrib.Lang1Alignment = ContentAlignment.MiddleLeft
            FrmMain.BangItemIsha.Lang1Alignment = ContentAlignment.MiddleLeft
            FrmMain.RightToLeft = Windows.Forms.RightToLeft.No
            'FrmMain.MnuStrpMain.RightToLeft = Windows.Forms.RightToLeft.No

        End If

    End Sub
    Public Sub ChangeLang2(ByVal LangFile As String)
        Dim DataFile As New INIFile
        DataFile.Load(Application.StartupPath & "\Data\Languages\" & LangFile)
        Dim PrayerName As INIFile.IniSection = DataFile.GetSection("PrayerNames")
        Dim INFO As INIFile.IniSection = DataFile.GetSection("INFO")
        Pr21 = PrayerName.GetKey("Fajr").GetValue
        Pr22 = PrayerName.GetKey("Shruq").GetValue
        Pr23 = PrayerName.GetKey("Dhuhr").GetValue
        Pr24 = PrayerName.GetKey("Asr").GetValue
        pr25 = PrayerName.GetKey("Maghrib").GetValue
        Pr26 = PrayerName.GetKey("Isha").GetValue

        'APPLY
        FrmMain.BangItemFajr.Lang2 = Pr21
        FrmMain.BangItemShruq.Lang2 = Pr22
        FrmMain.BangItemDhuhr.Lang2 = Pr23
        FrmMain.BangItemAsr.Lang2 = Pr24
        FrmMain.BangItemMaghrib.Lang2 = Pr25
        FrmMain.BangItemIsha.Lang2 = Pr26

        If INFO.GetKey("Direction").GetValue = "RTL" Then
            FrmMain.BangItemFajr.Lang2Alignment = ContentAlignment.MiddleRight
            FrmMain.BangItemShruq.Lang2Alignment = ContentAlignment.MiddleRight
            FrmMain.BangItemDhuhr.Lang2Alignment = ContentAlignment.MiddleRight
            FrmMain.BangItemAsr.Lang2Alignment = ContentAlignment.MiddleRight
            FrmMain.BangItemMaghrib.Lang2Alignment = ContentAlignment.MiddleRight
            FrmMain.BangItemIsha.Lang2Alignment = ContentAlignment.MiddleRight
        Else
            FrmMain.BangItemFajr.Lang2Alignment = ContentAlignment.MiddleLeft
            FrmMain.BangItemShruq.Lang2Alignment = ContentAlignment.MiddleLeft
            FrmMain.BangItemDhuhr.Lang2Alignment = ContentAlignment.MiddleLeft
            FrmMain.BangItemAsr.Lang2Alignment = ContentAlignment.MiddleLeft
            FrmMain.BangItemMaghrib.Lang2Alignment = ContentAlignment.MiddleLeft
            FrmMain.BangItemIsha.Lang2Alignment = ContentAlignment.MiddleLeft
        End If
    End Sub
End Module
